home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 22
/
Cream of the Crop 22.iso
/
utility
/
tsbat50.zip
/
PROMPT.TXT
< prev
next >
Wrap
Internet Message Format
|
1996-05-26
|
6KB
From ts@uwasa.fi Sun May 26 00:00:00 1996
Subject: Prompt file information
PROMPT.TXT prompt and related tips Sun 26-May-1996
==================================
All rights reserved
Copyright (c) 1993-1996 by Timo Salmi
....................................................................
Prof. Timo Salmi Co-moderator of news:comp.archives.msdos.announce
Moderating at ftp:// & http://garbo.uwasa.fi archives 193.166.120.5
Department of Accounting and Business Finance ; University of Vaasa
ts@uwasa.fi http://uwasa.fi/~ts BBS 961-3170972; FIN-65101, Finland
....................................................................
┌───────────────────────────────────────────────────────────┐
│ This file belongs to TSBAT*.ZIP. Please do not distribute │
│ this prompt.txt file separately! If you see this file │
│ alone on a BBS, please alert the SysOp immediately. │
└───────────────────────────────────────────────────────────┘
--------------------------------------------------------------------
From ts@uwasa.fi Sun May 26 00:00:01 1996
Subject: Changing the shell prompt
1) If you have programs that can shell to dos it would be nice to
know whether you currently are in a dos shell or not. Else you might
call the same program again from the shell and eventually run out of
memory. There is a rather straight-forward trick for this. Assume
that your program is called prog.exe. You can always call the
program from a batch, say pro.bat. Include the following lines in
your batch:
set _prompt=%prompt%
set prompt=%_prompt%[in shell or whatever text]
prog %1 %2 %3 %4 %5 %6 %7 %8 %9
set prompt=%_prompt%
set prompt=
The method will not work or will produce unexpected results if the
program itself manipulates the prompt when shelling to Dos. Some
(usually advanced) programs do.
Another trick to avoid double loading is shown in the following
skeleton
if "%_loaded%"=="yes" exit
set _loaded=yes
prog %1 %2 %3 %4 %5 %6 %7 %8 %9
set _loaded=
--------------------------------------------------------------------
From ts@uwasa.fi Sun May 26 00:00:02 1996
Subject: Redefining keys
2) A frequently asked question about ansi.sys is now does one use it
to redefine keyboard keys. Here is an example which redefines the F1
key invoke the directory "dir" command, the F2 key to invoke the
"dir/w" command, and the F3 to type the Scandinavian letter ä.
prompt $e[0;59;"dir";13p
prompt $e[0;60;"dir/w";13p
prompt $e[0;61;"ä"p
prompt $p$g
The last line is needed to restore the prompt in its usual format
(which I have as $p$g).
To cancel the definitions apply
prompt $e[0;59;;p
prompt $e[0;60;;p
prompt $e[0;61;;p
prompt $p$g
This system requires that you have ansi.sys loaded in your
config.sys file
device=c:\dos\ansi.sys
A related FAQ (Frequently Asked Question) is how to exchange the .
and , keys. here is how to do that
@echo <ESC>[",";"."p<ESC>[".";","p
To reverse the effect, apply
@echo <ESC>[",";","p<ESC>[".";"."p
This trick will not work for exchanging the CTRL and SHIFT keys.
They are not mappable this way.
Note that ansi.sys replacements like zansi.sys (which I normally use
myself) do not have the key-redefinition feature. This has one
advantages, that is protecting you against the so-called ansi bombs.
The 0;59 pair defines F1 because it is that key's scan code. To get
the scan codes of the different keys you need either a scan code
table or a program that gives the scan code of the key you have
pressed. One such program is SCANCODE.EXE. You can find it is
ftp://garbo.uwasa.fi/pc/ts/tsbase12.zip (or whatever version number
is the current).
--------------------------------------------------------------------
From ts@uwasa.fi Sun May 26 00:00:03 1996
Subject: Ansi prompt art
3) You can devise quite complicated ansi prompts to do flashy
things although much of this is rather computer entertainment than
serious usage. Let look at some examples
My ordinary prompt is the simple
prompt $p$g
which displays the directory followed bu the > sign. Furthermore I
use bright yellow on black, but for that I apply echo <ESC>[40;33;1m
Let's build from that.
prompt $d $t$_$p$g
Gives the date and the time on the first line ($d $t), then on the
second ($_) gives the current directory ($p) and the > sign ($g).
Lets take a little more complicated example next:
prompt $e[s$e[1;69H$t$h$h$h$e[u$p$g
To also include the date use:
prompt $e[s$e[1;54H$d$e[1;69H$t$h$h$h$e[u$p$g
This is of of the basic prompt tricks, and it puts the time (and
date) in the upper right corner of the screen. First the current
cursor position is stored ($e[s); the cursor is moved to row 1,
column 69 ($e[1;69H) the time is displayed ($t); the hundredths of a
second are deleted ($h$h$h); the original cursor position is
restored ($e[u); and finally the current directory and the > sign
are displayed ($p$g).
The next obvious step is to display the time in some garish reverse.
For the normal part of the prompt lets use my own default which is
bright yellow on black ($e[40;33;1m).
prompt $e[s$e[1;69H$e[41;32;1m$t$e[40;33;1m$h$h$h$e[u$p$g
The time is displayed in bright green on red ($e[41;32;1m).
The interpretation of the following prompt is left as an exercise:
prompt $e[s$e[H$e[43;30m$e[KDirectory $p $d $t $h$h$h$h $v
$e[40;33;1m$e[2;1H$e[K$e[u$p$g
Note that you must have everything on one line only. The wrap here
is just for readability.
One example of an "entertainment" prompt just to give the general
idea:
prompt $e[s$_$e[40;37m██$e[34m██$e[37m████$_$e[34m████████
$e[40;37m$_██$e[34m██$e[37m████$e[40;33m $p$g
Note that you must have everything on one line only. The wrap here
is just for readability.
The difference in using the echo and the prompt for setting the
screen colors is that the echo is invoked only when you apply it,
but the prompt is called each time the dos prompt appears.
--------------------------------------------------------------------
From ts@uwasa.fi Sun May 26 00:00:04 1996
Subject: Debugging the prompt
4) If you are having problems you can "debug" your prompt by giving
the set command in MS-DOS which displays your environment variables
including the prompt variable.